n = int(input())
buf = str(n) +' '
while n!=1:
    if n%2:
        n = n*3+1
    else:
        n = n//2
    buf += (str(n)+' ')
buf.strip()
print(buf)
